﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace ArcannEngine.Graphics
{
    public class Modificator
    {
        //private:
        float max;
        float min;
        float mod;
        public float what;
        //public:
        public Texture2D tex;
        public Rectangle plus;
        public Rectangle minus;
        public string desc;
        public string unit;
        public Vector2 descPos = new Vector2();
        public Vector2 unitPos = new Vector2();
        public Vector2 targetPos = new Vector2();
        public float Target
        {
            get
            {
                return what;
            }
        }

        public Modificator(Texture2D tex, float min, float max, float mod, ref float what, string desc, string unit, int a)
        {
            this.tex = tex;
            this.min = min;
            this.max = max;
            this.mod = mod;
            this.what = what;
            this.desc = desc;
            this.unit = unit;

            this.plus = new Rectangle(0, 0, a, a);
            this.minus = new Rectangle(0, 0, a, a);
        }

        public bool Inc()
        {
            bool success = false;
            if (what + mod <= max)
            {
                what += mod;
                success = true;
            }
            return success;
        }
        public bool Dec()
        {
            bool success = false;
            if (what - mod >= min)
            {
                what -= mod;
                success = true;
            }
            return success;
        }
    }
}
